package com.automannn.springPractice.applicationContext;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @author chenkh
 * @time 2021/8/20 11:35
 */

public class BeanFactoryTest {
    public static void main(String[] args) {
        DefaultListableBeanFactory beanFactory=new DefaultListableBeanFactory();
        XmlBeanDefinitionReader readerContext=new XmlBeanDefinitionReader(beanFactory);
        int beanDefinitionsCount = readerContext.loadBeanDefinitions("xmlApplication.xml");
        GenericXmlApplicationContextTest.A myA = (GenericXmlApplicationContextTest.A)beanFactory.getBean("myA");
        System.out.println(myA.getAge());
        System.out.println("容器bean定义个数"+beanDefinitionsCount);
    }
}
